In the field of image detection and recognition, a widely used technique is to identify certain features of an image so as to detect and identify objects in the image.
Conventionally, objects in an image may be detected and identified by extracting a Histogram of Oriented Gradient (HOG) feature of the image. The method for extracting the HOG feature includes calculating a gradient of each pixel in an image, and segmenting the image into a plurality of cells, where each cell includes a plurality of pixels, and adjacent n cells compose a block. The method further includes counting the histogram of gradient of all the pixels in each cell, obtaining the HOG feature of each block based on the histogram of gradient of all the cells in the block, and counting the HOG features of all the blocks in the image to obtain the HOG feature of the image.